package com.ssm.gbq.dao.impl;

import com.ssm.gbq.dao.FlowerTypeDao;
import com.ssm.gbq.mapper.FlowerTypeMapper;
import com.ssm.gbq.model.FlowerType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class FlowerTypeDaoImpl implements FlowerTypeDao {

    @Autowired
    private FlowerTypeMapper flowerTypeMapper;

    public List<FlowerType> showFlowerTypeByPage(FlowerType flowerType, int currentPage, int pageSize) throws Exception {
        return flowerTypeMapper.showFlowerTypeByPage(flowerType, currentPage, pageSize);
    }

    public FlowerType getFlowerTypeById(Integer fid) throws Exception {
        return flowerTypeMapper.getFlowerTypeById(fid);
    }

    public int updateFlowerType(FlowerType flowerType) throws Exception {
        return flowerTypeMapper.updateFlowerType(flowerType);
    }

    public int addFlowerType(FlowerType flowerType) throws Exception {
        return flowerTypeMapper.addFlowerType(flowerType);
    }

    public int delFlowerType(Integer fid) throws Exception {
        return flowerTypeMapper.delFlowerType(fid);
    }

    public int getFlowerTypeCount(FlowerType flowerType) {
        return flowerTypeMapper.getFlowerTypeCount(flowerType);
    }

    public int deleteFlowerTypes(List<Integer> ids) {
        return flowerTypeMapper.deleteFlowerTypes(ids);
    }

    /**
     * 判断所属类型是否为空
     * @param fid
     * @return
     */
    public int judgeType(List<Integer> fid) {
        return flowerTypeMapper.judgeType(fid);
    }
}
